home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / Implementation / OpenDocSetup / ST_.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-13  |  1.3 KB  |  46 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        ST_.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     6/21/96    NP        first checked in
  13.  
  14.     To Do:
  15. */
  16.  
  17. #ifndef DECLARE_ST_
  18.  
  19. #define    DECLARE_ST_(CLASSNAME, TYPE, DTOR, SAFEVAL)                                                 \
  20.                                                                                                     \
  21.     class CLASSNAME {                                                                                \
  22.         private:                                                                                    \
  23.             TYPE    the##TYPE;                                                                        \
  24.             void operator = (const TYPE &a##TYPE);                                                    \
  25.         public:                                                                                        \
  26.             CLASSNAME (const TYPE &a##TYPE) {the##TYPE = a##TYPE;}                                    \
  27.             ~CLASSNAME () {if (the##TYPE != SAFEVAL) DTOR (the##TYPE);}                                \
  28.             operator TYPE& (void) {return the##TYPE;}                                                \
  29.             void Forget (void) {the##TYPE = SAFEVAL;}                                                \
  30.     };
  31.  
  32. #define    DECLARE_STP_(CLASSNAME, TYPE, DTOR, SAFEVAL)                                                 \
  33.                                                                                                     \
  34.     class CLASSNAME {                                                                                \
  35.         private:                                                                                    \
  36.             TYPE    the##TYPE;                                                                        \
  37.             void operator = (const TYPE &a##TYPE);                                                    \
  38.         public:                                                                                        \
  39.             CLASSNAME (const TYPE &a##TYPE) {the##TYPE = a##TYPE;}                                    \
  40.             ~CLASSNAME () {if (the##TYPE != SAFEVAL) DTOR (&the##TYPE);}                                \
  41.             operator TYPE& (void) {return the##TYPE;}                                                \
  42.             void Forget (void) {the##TYPE = SAFEVAL;}                                                \
  43.     };
  44.  
  45. #endif
  46.